package april.test_4_11;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class TestMain3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        int result = returnRsult(s);
        System.out.println(result);
    }
    private static int returnRsult(String s) {
        char[] arr = s.toCharArray();
        ArrayList<Integer> r = new ArrayList<>();
        ArrayList<Integer> e = new ArrayList<>();
        ArrayList<Integer> d = new ArrayList<>();
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == 'r') {
                r.add(i);
            }
            if (arr[i] == 'e') {
                e.add(i);
            }
            if (arr[i] == 'd') {
                d.add(i);
            }
        }
        int count = 0;
        for (int i = 0; i < r.size(); i ++) {
            for (int j = 0; j < e.size(); j ++) {
                int max = Math.max(r.get(i), e.get(j));
                int min = Math.min(r.get(i), e.get(j));
                if (d.size() == 0) {
                    count += (min * (s.length() - max));
                    count++;
                } else {
                    for (int t = 0; t < d.size(); t++) {
                        int a = d.get(t);
                        if (a < min || a > max) {
                            if (a < min) {
                                count += ((min - a) * (s.length() - max));
                                count++;
                            } else {
                                count += ((min ) * (a - max));
                                count++;
                            }
                        }
                    }
                }
            }
        }
        return count;
    }
}
